<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8" %>
<%@ include file="/home/include/init_home.jsp" %>
<%@ page import="com.qbooks.store.book.*" %>
<%@ page import="com.qbooks.publisher.*" %>

<%
	String ty 				= StringUtil.nvl(request.getParameter("ty"));
	String publisher_id 	= StringUtil.nvl(request.getParameter("publisher_id"));
	
	String title = "";

	StoreDAO dao 	= new StoreDAO();
	
	HashMap infos = new HashMap();
	
	if (ty.equals("hit_free")) {	//무료인기
		infos.put("book_type", "0");	//무료
		infos.put("sort_col", "download_count");
		infos.put("sort_asc", "desc");
		infos.put("limit", "100");
		title = "무료인기";
	}
	else if (ty.equals("new")) {	//신규출간
		infos.put("sort_col", "a.init_date");
		infos.put("sort_asc", "desc");
		infos.put("limit", "100");
		title = "신규출간";
	}
	else if (ty.equals("publisher")) {	//발행자
		infos.put("publisher_id", publisher_id);
		infos.put("sort_col", "a.init_date");
		infos.put("sort_asc", "desc");
		
		PublisherDAO pubDao = new PublisherDAO();
		title = pubDao.selectPublisherInfo(infos).get("publisher_name",0);
	}


	HashList list 	= dao.selectBookList(infos);
	

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
	<title><%= HOME_NAME %></title>
	<%@ include file="/home/include/cssnjs.jsp"  %>
	<script type="text/javascript">
	$(document).ready(function() {
		$('.photo').hover(function () {         // 마우스 오버
				$(this).find('span.photo_box_over').stop(false,true).fadeIn(400);
			},
				function () {         // 마우스 아웃
				$(this).find('span.photo_box_over').stop(false,true).fadeOut(400);
			});

			$("#photo_focus").focus(function() { 
				$('#photo_box_over').show();
			}); 
	});
	
	</script>
</head>
<body>
	<div id="wrap">
	
		<%@ include file="/store/include/header.jsp"  %>
		
		<div id="contents">
			<div id="book_list">
				<h2><%= title %></h2>
				<ul>
	<% 	for (int i = 0; i < list.size(); i++) { %>
	            	<li>
	            		<div class="photo">
		            		<a href="/store/bookDetail.jsp?book_code=<%= list.get("book_code",i) %>">
		            			<img src="<%=list.get("book_image_url",i) %>"/>
		            			<span class="photo_box_over"></span>
		            		</a>
	            		</div>
	            		<div class="info">
		            		<h3><a href="/store/bookDetail.jsp?book_code=<%= list.get("book_code",i) %>"><%= list.get("book_name",i) %></a></h3>
		            		<p><%= list.get("publisher_name",i) %></p>
		            		<br/>
			            	<p>
			            		<%= list.get("download_count",i) %> download
			            		<span class="price"><%= "0".equals(list.get("book_type",i)) ? "무료" : StringUtil.toPrice(list.get("price",i))+"원" %></span>
			            	</p>
		            	</div>
	            	</li>
    <%	} %>
    			</ul>
    			
			</div>

		</div>
		
		<div class="both"></div>

		<%@ include file="/store/include/footer.jsp"  %>		
	</div>

</body>
</html>

